package algorithm;

/**@author apple
 * 二叉树的节点类
 * **/
public class TreeNode {
    /** 左节点**/
    public TreeNode leftTreeNode;
    /** 右节点**/
    public TreeNode rightTreeNode;

    /** 节点中的数据**/
    public int value;
    /** 是否删除**/
    public boolean deleteFlag;

    public TreeNode getLeftTreeNode() {
        return leftTreeNode;
    }
    public void setLeftTreeNode(TreeNode leftTreeNode) {
        this.leftTreeNode = leftTreeNode;
    }
    public TreeNode getRightTreeNode() {
        return rightTreeNode;
    }
    public void setRightTreeNode(TreeNode rightTreeNode) {
        this.rightTreeNode = rightTreeNode;
    }
    public int getValue() {
        return value;
    }
    public void setValue(int value) {
        this.value = value;
    }


    public boolean isDeleteFlag() {
        return deleteFlag;
    }
    public void setDeleteFlag(boolean deleteFlag) {
        this.deleteFlag = deleteFlag;
    }
    /**构造函数**/
    public TreeNode(TreeNode leftTreeNode,TreeNode rightTreeNode,int value,boolean deleteFlag) {
        super();
        this.leftTreeNode=leftTreeNode;
        this.rightTreeNode=rightTreeNode;
        this.value=value;
        this.deleteFlag=deleteFlag;
    }

    @Override
    public String toString() {
        return "TreeNode[leftTreeNode="+leftTreeNode+",rightTreeNode="+rightTreeNode
                +",value="+value+",deleteFlag="+deleteFlag+"]";
    }

    public  TreeNode(int value) {
        this(null,null,value,false);
    }

}
